@tailwind base;
@tailwind components;
@tailwind utilities;

/* 基础样式重置和改进 */
@layer base {
  html {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    scroll-behavior: smooth;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  body {
    @apply bg-gray-50 text-gray-900 leading-relaxed;
    min-height: 100vh;
  }

  * {
    box-sizing: border-box;
  }

  /* 链接样式 */
  a {
    @apply text-primary-600 hover:text-primary-700 transition-colors duration-200;
    text-decoration: none;
  }

  /* 标题样式改进 */
  h1, h2, h3, h4, h5, h6 {
    @apply font-semibold text-gray-900;
    line-height: 1.2;
  }

  h1 { @apply text-4xl md:text-5xl; }
  h2 { @apply text-3xl md:text-4xl; }
  h3 { @apply text-2xl md:text-3xl; }
  h4 { @apply text-xl md:text-2xl; }
  h5 { @apply text-lg md:text-xl; }
  h6 { @apply text-base md:text-lg; }

  /* 段落样式 */
  p {
    @apply text-gray-700 leading-relaxed;
  }

  /* 按钮基础样式 */
  button {
    @apply transition-all duration-200 ease-in-out;
  }

  /* 输入框样式 */
  input, textarea, select {
    @apply transition-all duration-200;
  }
}

/* 组件样式 */
@layer components {
  /* 卡片样式 */
  .card {
    @apply bg-white rounded-xl shadow-soft border border-gray-100 transition-all duration-300 hover:shadow-medium;
  }

  .card-header {
    @apply p-6 border-b border-gray-100;
  }

  .card-body {
    @apply p-6;
  }

  .card-footer {
    @apply p-6 border-t border-gray-100 bg-gray-50;
  }

  /* 按钮样式 */
  .btn {
    @apply inline-flex items-center justify-center px-4 py-2 text-sm font-medium rounded-lg transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2;
  }

  .btn-primary {
    @apply bg-primary-600 text-white hover:bg-primary-700 focus:ring-primary-500 shadow-sm hover:shadow-md;
  }

  .btn-secondary {
    @apply bg-gray-600 text-white hover:bg-gray-700 focus:ring-gray-500 shadow-sm hover:shadow-md;
  }

  .btn-success {
    @apply bg-success-600 text-white hover:bg-success-700 focus:ring-success-500 shadow-sm hover:shadow-md;
  }

  .btn-danger {
    @apply bg-danger-600 text-white hover:bg-danger-700 focus:ring-danger-500 shadow-sm hover:shadow-md;
  }

  .btn-outline {
    @apply border-2 border-primary-600 text-primary-600 hover:bg-primary-600 hover:text-white;
  }

  /* 统计数字样式 */
  .stat-number {
    @apply text-2xl md:text-3xl font-bold;
  }

  .stat-label {
    @apply text-sm text-gray-600 font-medium;
  }

  /* 进度条样式 */
  .progress-bar {
    @apply w-full bg-gray-200 rounded-full h-2 overflow-hidden;
  }

  .progress-fill {
    @apply h-full bg-primary-600 rounded-full transition-all duration-500 ease-out;
  }

  /* 徽章样式 */
  .badge {
    @apply inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium;
  }

  .badge-success {
    @apply bg-success-100 text-success-800;
  }

  .badge-danger {
    @apply bg-danger-100 text-danger-800;
  }

  .badge-warning {
    @apply bg-yellow-100 text-yellow-800;
  }

  .badge-info {
    @apply bg-blue-100 text-blue-800;
  }

  /* 导航样式 */
  .nav-link {
    @apply text-gray-700 hover:text-primary-600 px-3 py-2 rounded-md text-sm font-medium transition-colors duration-200;
  }

  .nav-link.active {
    @apply text-primary-600 bg-primary-50;
  }

  /* 表格样式 */
  .table {
    @apply min-w-full divide-y divide-gray-200;
  }

  .table th {
    @apply px-6 py-3 bg-gray-50 text-left text-xs font-medium text-gray-500 uppercase tracking-wider;
  }

  .table td {
    @apply px-6 py-4 whitespace-nowrap text-sm text-gray-900;
  }

  /* 图表容器样式 */
  .chart-container {
    @apply bg-white rounded-lg p-6 shadow-soft border border-gray-100;
  }
}

/* 工具样式 */
@layer utilities {
  /* 渐变背景 */
  .gradient-gold {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  }

  .gradient-blue {
    background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
  }

  .gradient-success {
    background: linear-gradient(135deg, #4ade80 0%, #22c55e 100%);
  }

  /* 文字渐变 */
  .text-gradient-gold {
    @apply bg-gradient-to-r from-gold-400 to-gold-600 bg-clip-text text-transparent;
  }

  .text-gradient-blue {
    @apply bg-gradient-to-r from-primary-400 to-primary-600 bg-clip-text text-transparent;
  }

  /* 阴影变体 */
  .shadow-colored {
    box-shadow: 0 4px 14px 0 rgba(59, 130, 246, 0.15);
  }

  .shadow-gold {
    box-shadow: 0 4px 14px 0 rgba(245, 158, 11, 0.15);
  }

  /* 动画类 */
  .animate-float {
    animation: float 6s ease-in-out infinite;
  }

  @keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
  }

  /* 响应式文字大小 */
  .text-responsive-xl {
    @apply text-xl md:text-2xl lg:text-3xl;
  }

  .text-responsive-lg {
    @apply text-lg md:text-xl lg:text-2xl;
  }

  .text-responsive-base {
    @apply text-base md:text-lg lg:text-xl;
  }

  /* 容器样式 */
  .container-custom {
    @apply max-w-7xl mx-auto px-4 sm:px-6 lg:px-8;
  }

  /* 滚动条样式 */
  .scrollbar-thin {
    scrollbar-width: thin;
    scrollbar-color: #d1d5db #f9fafb;
  }

  .scrollbar-thin::-webkit-scrollbar {
    width: 6px;
  }

  .scrollbar-thin::-webkit-scrollbar-track {
    background: #f9fafb;
    border-radius: 3px;
  }

  .scrollbar-thin::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
  }

  .scrollbar-thin::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
  }
}

/* 打印样式 */
@media print {
  .no-print {
    display: none !important;
  }
  
  .print-friendly {
    background: white !important;
    color: black !important;
    box-shadow: none !important;
  }
}

/* 深色模式准备（如果将来需要） */
@media (prefers-color-scheme: dark) {
  html {
    color-scheme: light; /* 强制浅色模式 */
  }
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
  .card {
    @apply border-2 border-gray-300;
  }
  
  .btn {
    @apply border-2;
  }
}

/* 减少动画（用户偏好） */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
